unit appMappldXmlResult;

interface

uses  classes, sysutils
    , nativeXml
    , xmlParameter
    , xmlObject
    , appMappldXmlNode
    , appMappldTypes
;
type

{------------------------------ TMappldXmlResult }

    {***************************************************************************
    * TMappldXmlResult
    ***************************************************************************}
    TMappldXmlResult = class( TMappldXmlObject )
public
    procedure   AfterConstruction(); override;
//    function    addCommandResult( aCmd : TMappldXmlCommand ) : TMappldXmlNode;

public //property
    property version   : string index 0 read getStringParameter write setStringParameter;
    //property ticket    : string index 1 read getStringParameter write setStringParameter;
    property sessionId : string index 1 read getStringParameter write setStringParameter;

    end;

{------------------------------ TMappldXmlResultDoc }

    {***************************************************************************
    * TMappldXmlResultDoc
    ***************************************************************************}
    TMappldXmlResultDoc = class( TXmlObjectDoc )
private
    Fresult                     : TMappldXmlResult;

protected
    function    getNodeClass() : TXmlNodeClass; override;

public
    procedure   AfterConstruction(); override;

public // propetry
    property result : TMappldXmlResult read Fresult;

    end;

implementation

{------------------------------ TMappldXmlResultDoc }

{*******************************************************************************
* getNodeClass
*******************************************************************************}
function TMappldXmlResultDoc.getNodeClass() : TXmlNodeClass;
begin
    Result := TMappldXmlNode;
end;

{*******************************************************************************
* AfterConstruction
*******************************************************************************}
procedure TMappldXmlResultDoc.AfterConstruction();
begin
    inherited;

    EncodingString := XML_SERVER_CHARSET;
    XMLFormat      := xfCompact;

    //Root.Name := XML_TAG_OBJECT;
    //Root.AttributeAdd( XML_TAG_ATTR_CLASS, XML_C_TMapplResult );
    Root.Name := XML_A_TMapplResult;

    Fresult := TMappldXmlResult.Create( TXmlObjectNode( Root ) );
end;

{------------------------------ TMappldXmlResult }

{*******************************************************************************
* AfterConstruction
*******************************************************************************}
procedure TMappldXmlResult.AfterConstruction();
var
    v : TXmlNodeAttribute;

begin
    inherited;

    v := addAttributeParameter( XML_A_version ); // protocol version
//    v.flBufferedXmlWrite := false;
    v.asString := MAPPLD_PROTOCOL_VERSION;

    //addAttributeParameter( XML_A_ticket ); // ticket
    addAttributeParameter( XML_A_session ); // session id
end;

end.
 